/**
 * @file 例子接口
 * @author its-wild(https://gitee.com/its-wild)
 * @date 2022/08/17
 */
import { apis } from '@/assets/ts/config'
import { post } from '@/plugins/axios'

/**
 * 接口前缀
 */
const { uc } = apis

interface IList {
  limit: string
  page: number
  schoolId: string
  teacherName?: string
  teacherPhone?: string
}

/**
 * 获取列表数据
 * @param {IList} data 请求参数
 * @returns Promise
 */
export const getList = (data?: IList): Promise<any> => {
  return post(`${uc}admin/school-user/page-teacher`, data)
}

interface IDel {
  schoolUserId: string
}

/**
 * 删除列表数据
 * @param {IDel} data 请求参数
 * @returns Promise
 */
export const del = (data?: IDel): Promise<any> => {
  return post(`${uc}admin/school-user/delete-school-user`, data)
}

export interface IMdl {
  gender?: string
  mobile?: string
  schoolUserId?: string
  schoolUserType?: string
  teacherName?: string
  schoolId?: string
}

/**
 * 添加数据
 * @param {IMdl} data 请求参数
 * @returns Promise
 */
export const addTo = (data?: IMdl): Promise<any> => {
  return post(`${uc}admin/school-user/add-school-user`, data)
}

/**
 * 更新数据
 * @param {IMdl} data 请求参数
 * @returns Promise
 */
export const update = (data?: IMdl): Promise<any> => {
  return post(`${uc}admin/school-user/update-school-user`, data)
}
